@extends('common.base-master')

@section('html-head')
    <script src="https://cdn.bootcss.com/jquery-weui/1.2.0/js/city-picker.min.js"></script>
@endsection

@section('html-body')
    <div class="coinsdetail-page">
        <div class="header">
            <h1 class="coin-num">@if($userinfo){{$userinfo->coin}} @endif</h1>
            <h5>当前波罗币</h5>
        </div>
        <div class="container">
            <div class="search-box">
                <span>日期范围：</span>
                <input type="text" name="date" id="date">
                <button class="search-btm">查询</button>
            </div>
            <div class="detail-content">
                @if(count($coins) > 0)
                    @foreach($coins as $coin)
                <div class="detail-item">
                    <img class="avatar" src="{{route('Api.Image.showPhotoByUserid',['id'=>$userinfo?$userinfo->user_id:0])}}" alt="avatar">
                    <div class="text">
                        {{$coin->desc}}
                    </div>
                    <div class="time">
                        {{$coin->created_at}}
                    </div>
                    <div class="tips">
                        @if((int)$coin->coin  > 0) +{{$coin->coin}}@else{{$coin->coin}} @endif波罗币
                    </div>
                </div>
                    @endforeach
                @endif
            </div>
        </div>
    </div>
    <script>
        $(function () {
            $("#date").calendar();

            $(".search-btm").click(function () {
                var date = $('#date').val();
                window.location.href="{{route('Home.User.coinDetail')}}?date="+date;
            });
        });
    </script>
@endsection